/*****************************************************************************
 * Copyright (C) Stacy Curl. All rights reserved.                            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *****************************************************************************/
package picounit.features.test_finder;

import picounit.features.Feature;
import picounit.features.base.FeatureRegistry;
import picounit.features.class_finder.ClassFinder;
import picounit.features.coverage_measuring.SuiteDecorator;
import picounit.features.failures_first.ProblemTracker;
import picounit.features.failures_first.StatusPersister;
import picounit.features.test_factory.TestFactory;
import picounit.features.test_instantiator.TestInstantiator;

public class TestFinderFeature implements Feature {
	private final StatusPersister statusPersister;
	private final SuiteDecorator suiteDecorator;
	private final TestFactory testFactory;
	private final TestInstantiator testInstantiator;
	private final ClassLoader classLoader;
	private final ProblemTracker problemTracker;
	private final ClassFinder classFinder;
	private final ObjectReloader objectReloader;

	public TestFinderFeature(StatusPersister statusPersister, SuiteDecorator suiteDecorator,
		TestFactory testFactory, TestInstantiator testInstantiator, ClassLoader classLoader,
		ProblemTracker problemTracker, ClassFinder classFinder, ObjectReloader objectReloader) {

		this.statusPersister = statusPersister;
		this.suiteDecorator = suiteDecorator;
		this.testFactory = testFactory;
		this.testInstantiator = testInstantiator;
		this.classLoader = classLoader;
		this.problemTracker = problemTracker;
		this.classFinder = classFinder;
		this.objectReloader = objectReloader;
	}

	public void addFeatures(FeatureRegistry featureRegistry) {
		featureRegistry.addFeatures(
			new DirectoryScanningTestFinder(statusPersister, classFinder, suiteDecorator,
				testFactory, testInstantiator, classLoader, problemTracker, objectReloader));
	}
}
